import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: {
      id:'',
      isLogin:false
    },
    study:false,
    answerCard:[],
    grade:0
  },
  mutations: {
    // 用户状态行为
    set_userid (state,user) {
      state.user = user;
    },
    del_user (state,user) {
      state.user=user;
    },
    //设置用户学习还是练习状态管理
    set_study(state,study){
      state.study = study;
    },
    //设置用户答题卡
    set_answerCard(state,answerCard){
      state.answerCard.push(answerCard)
    },
    //设置用户成绩
    set_grade(state,grade){
      state.grade+=grade
    }
  }
})
